package cn.ctodb.mall.goods.domain;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.data.elasticsearch.annotations.Document;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

import cn.ctodb.mall.goods.domain.enumeration.IsCheck;

/**
 * A Brand.
 */
@Entity
@Table(name = "brand")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "brand")
public class Brand implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "brand_name")
    private String brandName;

    @Column(name = "brand_logo")
    private String brandLogo;

    @Lob
    @Column(name = "brand_desc")
    private String brandDesc;

    @Column(name = "site_url")
    private String siteUrl;

    @Column(name = "sort_order")
    private Integer sortOrder;

    @Enumerated(EnumType.STRING)
    @Column(name = "is_show")
    private IsCheck isShow;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getBrandName() {
        return brandName;
    }

    public Brand brandName(String brandName) {
        this.brandName = brandName;
        return this;
    }

    public void setBrandName(String brandName) {
        this.brandName = brandName;
    }

    public String getBrandLogo() {
        return brandLogo;
    }

    public Brand brandLogo(String brandLogo) {
        this.brandLogo = brandLogo;
        return this;
    }

    public void setBrandLogo(String brandLogo) {
        this.brandLogo = brandLogo;
    }

    public String getBrandDesc() {
        return brandDesc;
    }

    public Brand brandDesc(String brandDesc) {
        this.brandDesc = brandDesc;
        return this;
    }

    public void setBrandDesc(String brandDesc) {
        this.brandDesc = brandDesc;
    }

    public String getSiteUrl() {
        return siteUrl;
    }

    public Brand siteUrl(String siteUrl) {
        this.siteUrl = siteUrl;
        return this;
    }

    public void setSiteUrl(String siteUrl) {
        this.siteUrl = siteUrl;
    }

    public Integer getSortOrder() {
        return sortOrder;
    }

    public Brand sortOrder(Integer sortOrder) {
        this.sortOrder = sortOrder;
        return this;
    }

    public void setSortOrder(Integer sortOrder) {
        this.sortOrder = sortOrder;
    }

    public IsCheck getIsShow() {
        return isShow;
    }

    public Brand isShow(IsCheck isShow) {
        this.isShow = isShow;
        return this;
    }

    public void setIsShow(IsCheck isShow) {
        this.isShow = isShow;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Brand brand = (Brand) o;
        if (brand.id == null || id == null) {
            return false;
        }
        return Objects.equals(id, brand.id);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id);
    }

    @Override
    public String toString() {
        return "Brand{" +
            "id=" + id +
            ", brandName='" + brandName + "'" +
            ", brandLogo='" + brandLogo + "'" +
            ", brandDesc='" + brandDesc + "'" +
            ", siteUrl='" + siteUrl + "'" +
            ", sortOrder='" + sortOrder + "'" +
            ", isShow='" + isShow + "'" +
            '}';
    }
}
